package kr.hkit.powerjava.chapter22.homework;

import java.util.ArrayList;
import java.util.Random;

public class RandomList<T> {
	private ArrayList<T> arList;
	Random rd = new Random();
		
	public RandomList(ArrayList<T> arList) {
		this.arList = arList;
	}

	public ArrayList<T> getArList() {
		return arList;
	}

	public void setArList(ArrayList<T> arList) {
		this.arList = arList;
	}

	public void add(T item) {
		arList.add(item);
	}
	
	public T select() {
		System.out.print("select 메소드 수행결과는 : ");
		int i = rd.nextInt(arList.size());
		return arList.get(i);
	}
	
	public void prnList() {
		for(T a : arList) {
			System.out.println(a);
		}
		System.out.println();
	}
}
